import java.util.HashMap;

public class Solution1 {
    public int firstUniqChar(String string) {
        //cbcad
        int[] count = new int[26];

        for (int i = 0; i < string.length(); i++) {
            count[string.charAt(i) - 97]++;
        }
        for (int i = 0; i < string.length(); i++) {
            if (count[string.charAt(i) - 97] == 1) {
                return i;
            }
        }
        return -1;
    }

    public static void main(String[] args) {
        String s = "cbcad";

        System.out.println(s.charAt(new Solution1().firstUniqChar(s)));
    }
}
